/*
 * Copyright 2006 - Chris Maki
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package org.agoracms.service.impl;

import java.io.Serializable;
import java.util.List;

import org.agoracms.dao.GenericDao;
import org.agoracms.dao.NamedQueryParameter;
import org.agoracms.dao.QueryParameter;
import org.agoracms.dao.QueryParameter.TemporalType;
import org.agoracms.service.GenericManager;

public class GenericManagerImpl<T, PK extends Serializable> implements GenericManager<T, PK> {

	GenericDao<T, PK> dao;
	
	public void setDao(GenericDao<T, PK> dao) {
		this.dao = dao;
	}

	public void clear() {
		dao.clear();
	}

	public List<T> find(String query) {
		return dao.find(query);
	}

	public List<T> find(String query, Object value) {
		return dao.find(query, value);
	}

	public List<T> find(String query, String name, Object value) {
		return dao.find(query, name, value);
	}

	public List<T> findAll() {
		return dao.findAll();
	}

	public List<T> findByNamedQuery(String queryName) {
		return dao.findByNamedQuery(queryName);
	}

	public List<T> findByNamedQueryNamedParameter(String queryName, String name, Object value) {
		return dao.findByNamedQueryNamedParameter(queryName, name, value);
	}

	public List<T> findByNamedQueryNamedParameter(String queryName, String name, Object value, TemporalType type) {
		return dao.findByNamedQueryNamedParameter(queryName, name, value, type);
	}

	public List<T> findByNamedQueryNamedParameter(String queryName, NamedQueryParameter... args) {
		return dao.findByNamedQueryNamedParameter(queryName, args);
	}

	public List<T> findByNamedQueryPositionalParameter(String queryName, QueryParameter... args) {
		return dao.findByNamedQueryPositionalParameter(queryName, args);
	}

	public T findByPk(PK pk) {
		return dao.findByPk(pk);
	}

	public T findInstanceByNamedQuery(String queryName) {
		return dao.findInstanceByNamedQuery(queryName);
	}

	public T findInstanceByNamedQueryNamedParameter(String queryName, NamedQueryParameter... args) {
		return dao.findInstanceByNamedQueryNamedParameter(queryName, args);
	}

	public T findInstanceByNamedQueryPositionalParameter(String queryName, QueryParameter... args) {
		return dao.findInstanceByNamedQueryPositionalParameter(queryName, args);
	}

	public List<T> findNamedParameter(String query, NamedQueryParameter... args) {
		return dao.findNamedParameter(query, args);
	}

	public List<T> findPositionalParameter(String query, QueryParameter... args) {
		return dao.findPositionalParameter(query, args);
	}

	public void flush() {
		dao.flush();
	}

	public T merge(T object) {
		return dao.merge(object);
	}

	public T persist(T object) {
		return dao.persist(object);
	}

	public void remove(T object) {
		dao.remove(object);
	}
	
}
